# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=mimetreeparser
pkgver=24.08.2
pkgrel=0
pkgdesc="Parser for MIME trees"
# armhf blocked by extra-cmake-modules
# s390x: blocked by kmbox
arch="all !armhf !s390x"
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later AND LGPL-2.0-only AND LGPL-2.1-or-later AND BSD-3-Clause AND GPL-2.0-or-later"
makedepends="
	doxygen
	extra-cmake-modules
	gpgme-dev
	graphviz
	kcalendarcore-dev
	kcodecs-dev
	ki18n-dev
	kmbox-dev
	kmime-dev
	kwidgetsaddons-dev
	libkleo-dev
	qt6-qt5compat-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qttools-dev
	samurai
	"
checkdepends="
	gpg-agent
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/pim/mimetreeparser.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/mimetreeparser-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	xvfb-run -a ctest --test-dir build --output-on-failure -E "(core-attachment|core-cryptohelper|core-mimetreeparser|core-gpgerror|core-partmodel|widgets-messageviewer|widgets-messageviewerdialog)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
dad3676ec766befe1090f619b56678327c3528313271fe9009801907a49effa02f45bbb07b035e596386401c0a580fe40777cfbd432a1055fe63d93e63474595  mimetreeparser-24.08.2.tar.xz
"
